<%--
  @desc: 应用列表首页
  @author: chenw
  @create: 2014-4-29 下午 15:32
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<div class="pageHeader">
    <form rel="pageForm" onsubmit="return navTabSearch(this);" action="<c:url value='/sys/resource/list'/>" method="post">
        <div class="searchBar">
            <ul>
                <li style="float: left;line-height: 25px;">
                    <label for="txt_keywords">资源名称：</label>
                    <input id="txt_keywords" name="keywords" type="text" value="${query.keywords}"/>
                </li>
                <li>
                    <div class="buttonActive" style="margin-left: 5px;">
                        <div class="buttonContent">
                            <button type="submit">查找</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
<div class="pageContent" style="padding-top: 1px;border-top: 1px solid #ccc;">
    <div class="panelBar">
        <ul class="toolBar" style="float: left;display: inline-block;">
            <li><a class="add" href="<c:url value='/sys/resource/toadd'/>" target="dialog" width="580" height="280" mask="true" resizable="false"
                   maxable="false" title="新增资源"><span>新增</span></a></li>
            <li class="line"></li>
            <li><a class="delete" href="<c:url value='/sys/resource/del/{sel_sid}'/>" target="ajaxDel" title="确认删除？"  callback="callbackDel"><span>删除</span></a></li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="114">
        <thead>
        <tr>
            <th width="40" align="center">序号</th>
            <th orderField="name" <c:if test='${query.orderField eq "name" }'> class="${query.orderDirection}"</c:if>>资源名称</th>
            <th class="cen">备注信息</th>
            <th width="110" nowrap="false" style="width:130px;">资源路径</th>
            <th width="80" orderField="method" <c:if test='${query.orderField eq "method" }'> class="${query.orderDirection}"</c:if>>方法名</th>
            <th width="50" orderField="sort" <c:if test='${query.orderField eq "sort" }'> class="${query.orderDirection}"</c:if>>排序</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="res" items="${pager.list}" varStatus="vs">
            <tr ondblclick=" " target="sel_sid" rel="${res.id}">
                <td>${vs.count+(pager.pageNum-1)*pager.numPerPage}</td>
                <td>${res.name}</td>
                <td title="${res.remark}">${res.remark}</td>
                <td title="${res.pkg}">..${fn:substringAfter(res.pkg,"modules")}</td>
                <td title="${res.method}">${res.method}</td>
                <td>${res.sort}</td>
                <td>
                    <a href="javascript:editResource('<c:url value='/sys/resource/edit/${res.id}'/>');">编辑</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示&nbsp;</span>
            <select id="cob_ps" class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
            </select>
            <span>条，共${pager.total}条</span>
        </div>
        <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.numPerPage}" pageNumShown="10"
             currentPage="${pager.pageNum}"></div>
    </div>
    <form id="pagerForm" method="post" action="<c:url value='/sys/resource/list'/>">
        <input type="hidden" name="pageNum" value="${pager.pageNum}"/>
        <input type="hidden" name="keywords" value="${query.keywords}"/>
        <input type="hidden" name="numPerPage" value="${pager.numPerPage}"/>
        <input type="hidden" name="orderField" value="${query.orderField}"/>
        <input type="hidden" name="orderDirection" value="${query.orderDirection}"/>
    </form>
</div>
<script type="text/javascript">
    function editResource(url) {
        $.pdialog.open(url, "page_resource_edit", "资源编辑", {mask: true, width: 420, height: 220, maxable: false, resizable: false});
    }
</script>
